/**
 * 
 */
var btnList, btnSave, btnDelete, btnModify;
var url='index1.jsp?inc=./port/';
function general(){

	if(document.getElementById("btn") !=null){
		document.getElementById("btn").onclick = function(){
//			alert(rno);
		}
	} 
	
	if (document.getElementById('btnList') != null) {
		document.getElementById('btnList').onclick = function(){
				location.href = 'index1.jsp';
		}
	}
	if (document.getElementById('btnInput') != null) {
		document.getElementById('btnInput').onclick = function() {
			location.href = url+'portInput.jsp';
		}
	}
}

function listInit() {
	general();

}
function ir() {
	if (document.getElementById('btnList') != null) {
		document.getElementById('btnList').onclick = function(){
				location.href = 'index1.jsp';
		}
	}
}

function goView(page, rno) {
	var f = document.getElementById('portFrm');
	f.nowPage.value = page;
	f.rno.value = rno;
	f.find.value = document.port_list_frm.find.value;
	f.action = url+'portView.jsp?page='+page+'&rno='+rno;
	f.submit();

}
function goView1(page, rno) {
	var f = document.getElementById('portFrm');
	f.nowPage.value = page;
	f.rno.value = rno;
	f.find.value = document.port_list_frm.find.value;
	f.action = 'Imageboard_res.jsp';
	f.submit();
}

function goPage(page) {
	var f = document.getElementById('portFrm')
	f.nowPage.value = page;
	f.find.value = document.port_list_frm.find.value;
	f.action ='index1.jsp?page='+page;
	f.submit();
}
function goPage1(page) {

	var f = document.getElementById('portFrm')
	f.nowPage.value = page;
	f.find.value = document.port_list_frm.find.value;
	f.action =url+'v_top_product.jsp?';
	f.submit();
}


function portViewInit() {
	general();
	var pf = document.getElementById("portFrm");
	if (document.getElementById('btnModify') != null) {
		document.getElementById('btnModify').onclick = function(){
			pf.action = url+'portModify.jsp';
			pf.submit();
		}
	}

	if (document.getElementById('btnDelete')!= null) {
		document.getElementById('btnDelete').onclick = function() {
			var c = confirm("정말로 삭제하시겠습니까?");
			if(c)
				{
					pf.action = url+'portDelete.jsp';
					pf.submit();
				}
		}
	}
}

	function portModifyInit() {
		general();
		var f = document.getElementById("portmFrm");
		if(document.getElementById('btnModify')!=null){
		document.getElementById('btnModify').onclick = function() {
			if (f.writer.value==''){alert('수정하시겠습니까?');} 
			else {f.submit();}
			}
		}
	}
function portDeleteInit() {
	general();
}

function inputInit()
{
	var f = document.getElementById("portFrm");
	if(document.getElementById('btnSave')!=null){
	document.getElementById('btnSave').onclick = function() {
		if (f.writer.value==''){alert('입력하신 데이터가 부족합니다');} 
		else {f.submit();}
		}
	}
	
	if(document.getElementById('btnList')!=null)
		{
			document.getElementById('btnList').onclick = function()
			{
				alert("?");
				var y = confirm("작성을 취소하시겠습니까?" +"<br>" + "작성 중인 글은 제거됩니다.");
				if(y)
					{
					location.href = 'index1.jsp'
					}
			}
		}
}
